<?php

/**
 * Dao of Apply Gift Log
 *
 * @author Steve
 */
require_once BaseUtil::getModulePath("base") . '/models/BaseDao.php';

class ApplyGiftLogDao extends BaseDao {
    protected $_name;

    public function  _setup() {
        $this->_name = $this->prefix() . "apply_gift_logs";
        parent::_setup();
    }
    
    public function getApplyGiftLogById($id){
    	$select = $this->db_r->select();
        $select->from($this->_name,"*");
        $select->join("users","$this->_name.user_id=users.id","name");
        $select->where("$this->_name.id=?",$id);
        $select->where("$this->_name.is_delete = 0");
        $sql = $select->__toString();
        $result = $this->db_r->fetchRow($sql);
        return $result;
    }
    
    public function deleteApplyGiftLog($id){
        $isDel = array(
            "is_delete" => 1
        );
        $where = $this->db_w->quoteInto('id = ?', $id);
        $this->updateData($isDel, $where);
    }
    
    public function updateApplyGiftLog($data,$id){
    	$where = $this->db_w->quoteInto('id = ?', $id);
    	$this->updateData($data, $where);
    }
}
?>